#pragma once
#include "fxcc/core/audio/common/pch.h"

namespace fxcc
{
    namespace audio
    {
        namespace common
        {

            struct FXCC_API WavFile
            {

#pragma pack(push, 1)

                struct FXCC_API WAVHeader {
                    char chunkID[4];
                    uint32_t chunkSize;
                    char format[4];
                    char subchunk1ID[4];
                    uint32_t subchunk1Size;
                    uint16_t audioFormat;
                    uint16_t numChannels;
                    uint32_t sampleRate;
                    uint32_t byteRate;
                    uint16_t blockAlign;
                    uint16_t bitsPerSample;
                    char subchunk2ID[4];
                    uint32_t subchunk2Size;
                };
#pragma pack(pop)

                WAVHeader m_Header;

                //uint8_t* m_Data = 0;
                std::vector<uint8_t> m_Data;

                std::string m_Path;

                using Desc = std::string;

                Desc m_Desc;

                bool m_Available{ 0 };

                WavFile(const std::string& _p);

                bool Init();

                uint32_t DataSize();

                uint8_t* Data();

                uint32_t SampleRate();

                uint16_t GetAlFormat();

                ~WavFile();
            };

        }
    }
}